<?php
include_once 'common/tools.php';
//启用一个带有ob_gzip压缩机的工作台
ob_start('ob_gzip');

$uId = $_GET["uId"];

$config = require 'conf/config.ini.php';      //加载公用config.ini.php
$conn = mysql_connect($config["DB_HOST"], $config["DB_USER"], $config["DB_PWD"]);
mysql_select_db($config["DB_NAME"], $conn);
mysql_query("SET NAMES utf8");

$sql = "select t.topicId id, t.replayId replayId, t.topicContent content, u.userId, (select userId from live_user where id = t.atUserId) atUserId, u.id uId, u.userPic, u.userCity, u.userSex, IF(u.userBirthDay <> '0000-00-00', (YEAR(CURDATE())-YEAR(u.userBirthDay))-(RIGHT(CURDATE(),5)<RIGHT(u.userBirthDay,5)), '0') userAge, t.updateDate,".
		"(select concat('<font color=#2D86B0>', lu.userId , '</font> <font color=#000000>', topicContent, '</font> <font color=#2D86B0>', topicTitle, '</font>') from live_topic lt,live_user lu where lt.userId = lu.id and lt.topicId = t.replayId) topicContent ".
		"from live_topic t ,live_user u ".
		"where  ".
		"	 u.id = t.userId ".
		"and t.atUserId = '" . $uId . "' ".
		"and t.openFlg = 'N' ".
		"order by t.updateDate desc";
$list = mysql_query($sql, $conn);
while ($obj = mysql_fetch_object($list)) {
	$objArray[] = $obj;
}
//echo '{"sql":"' . $sql . '","results":' . json_encode($objArray) . '}';
echo '{"results":' . json_encode($objArray) . '}';

//输出压缩成果
ob_end_flush();
?>